package com.dzz.sjgl.entity;

import org.hibernate.annotations.Proxy;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

/**
 * @author KRIC
 * @ClassName UserInfo
 * @Date: 2019/3/13 11:38
 * @Description:
 */
@Entity
@Proxy(lazy = false)
@Table(name = "user_info", schema = "sjgl")
public class UserInfo {
    private int id;
    private String login;
    private String name;
    private String password;
    private Date lastLogin;
    private Date createTime;
    private Date thisLogin;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "login", nullable = false, length = 40)
    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    @Basic
    @Column(name = "name", nullable = false, length = 40)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "password", nullable = false, length = 40)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "last_login", nullable = true)
    public Date getLastLogin() {
        return lastLogin;
    }

    public void setLastLogin(Date lastLogin) {
        this.lastLogin = lastLogin;
    }

    @Basic
    @Column(name = "create_time", nullable = true)
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        UserInfo userInfo = (UserInfo) o;
        return id == userInfo.id &&
                Objects.equals(login, userInfo.login) &&
                Objects.equals(name, userInfo.name) &&
                Objects.equals(password, userInfo.password) &&
                Objects.equals(lastLogin, userInfo.lastLogin) &&
                Objects.equals(createTime, userInfo.createTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, login, name, password, lastLogin, createTime);
    }

    @Basic
    @Column(name = "this_login", nullable = true)
    public Date getThisLogin() {
        return thisLogin;
    }

    public void setThisLogin(Date thisLogin) {
        this.thisLogin = thisLogin;
    }
}
